<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>后台登陆</title>
    <meta name="author" content="Codrops" />
    <script type="text/javascript">
        var themetype = localStorage['easyuitheme']||"default";
        document.write('<link rel="stylesheet" type="text/css" href="__PUBLIC__/easyui/themes/'+themetype+'/easyui.css"/>')
    </script>
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/easyui/themes/icon.css"/>
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/easyui/themes/all.css"/>
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/css/index.css"/>
    <script type="text/javascript" src="__PUBLIC__/easyui/jquery.min.js"></script>
    <script type="text/javascript" src="__PUBLIC__/easyui/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="__PUBLIC__/easyui/locale/easyui-lang-zh_CN.js"></script>
    <script type="text/javascript" src="__PUBLIC__/js/json2.js"></script>
    <script type="text/javascript" src="__PUBLIC__/js/common.js"></script>
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/css/style.css" />
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/css/animations.css"/>

    <!--[if lte IE 7]><style>.main{display:none;} .support-note .note-ie{display:block;}</style>
    <![endif]-->

    <style>
        *all{
            margin: 0;
            padding: 0;
        }
        div.inner,table{
            position:absolute;
        }
		body{
			background-image:url('__PUBLIC__/images/bg2.jpg');
			background-size:100%;
		}
        .outer{
            height: 100%;
            background-color: rgba(255,255,255,0.5);    
        }
        .inner{
			border: 5px solid rgba(255,255,255,1);
		    border-radius: 20px;
		    width: 370px;
		    height: 340px;
		    top: 40%;
		    left: 76%;
		    transform: translate(-50%,-50%);
			box-shadow:11px 11px 11px rgba(50,50,50,1);
			background-color: rgba(255,255,255,0.5);  
        }
        .table{
            top: 7%;
		    left: 12%;
			//border: solid;
			width: 260px;
			height: 190px;
			border-spacing:7px;
			color: #333;
		}
        .under{
            position: fixed; 
            left: 0px; 
            bottom: 30px; 
            width: 100%; 
            text-align:center;
            font-size: 15px;
        }
		.Time{
			top: 65%;
			left: 62%;
            position: fixed; 
			width: 400px;
			text-align:right;
		}
		.TEXT{
			height:72%;
			width: 200px;
		}
		a {text-decoration: none}
    </style>

    <script type="text/javascript">

        $(function () {
            document.onkeydown=function (e){
                e = e ? e : event;
                if(e.keyCode == 13){
                    login();
                }
            }
        });

        /*function login() {
            var username = $("#username").val();
            var passwd = $("#passwd").val();
            if(trim(username) == "" || trim(passwd) == ""){
                $.messager.alert("提示", '请输入用户名和密码！');
                return;
            }
            openBackGround();
            ajaxCallback("login",{username:username,passwd:passwd},function(data){
                closeBackGround();

                if (data.info == "-1") {
                    $.messager.alert("提示", '用户名或密码错误！');
                } else {
                    //$.messager.alert("提示", '登录成功！');
                    window.location.href = "index.html";
                    localStorage['userinfo'] = JSON.stringify(data);
                }
            });
        }*/





        if(top.location!=self.location) top.location=self.location;

        var loginuserinfo =  localStorage["loginuserinfo"];
        var isremember = localStorage['isremember'];

        if(loginuserinfo){
            var info = JSON.parse(loginuserinfo);
            $("#passwd").val(info.passwd);
            $("#username").val(info.username);
        }

        if(isremember=="1"){
            $("#remember").attr("checked","checked");
        }

        document.onkeydown=function (e){
            e = e ? e : event;
            if(e.keyCode == 13){
                login();
            }
        };
        function login() {
            var username = $("#username").val();
            var passwd = $("#passwd").val();
            if(trim(username) == "" || trim(passwd) == ""){
                //$.messager.alert("提示", '请输入user name和密码！');
                $("#logindialog").addClass("shake");
                setTimeout(function(){
                    $("#logindialog").removeClass("shake");
                },500);
                return;
            }
            $("#logindialog").addClass("zoom");
            $("#loginimg").hide();
            $.post("/database/find", {table:"user",username:username,passwd:passwd}, function(data) {
            	closeBackGround();
                //data = JSON.parse(data);
                if (!data) {
                    $("#logindialog").removeClass("zoom");
                    $("#logindialog").addClass("shake");
                    setTimeout(function(){
                        $("#logindialog").removeClass("shake");
                    },500);
                    //$.messager.alert("提示", 'user name或密码错误！');
                    $("#loginimg").show();
                } else {
                    //$.messager.alert("提示", '登录成功！');
                    var flag = $("#remember").is(":checked");
                    if(flag){
                        var loginobj = {};
                        loginobj.username = username;
                        loginobj.passwd = passwd;
                        localStorage["loginuserinfo"] = JSON.stringify(loginobj);
                        localStorage["isremember"] = "1";
                    }else{
                        localStorage.removeItem("loginuserinfo");
                        localStorage.removeItem("isremember");
                    }
                    var userinfostr = JSON.stringify(data);
                    localStorage['userinfo'] = userinfostr;
                    $.post("/home/setSession", {key:"userinfo",value:userinfostr}, function(r) {
                    	window.location.href = "index.html";
					});
                    
                }
			});
        }


    </script>
</head>
<body>
<div class="outer">
		<div class="inner">
			<table class="table">
				<caption> <h1>后台管理系统</h1> </caption>
				<tr height="30px">
					<td><big><b>账&nbsp;&nbsp;号</b></big></td>
					<td><input type="text" name="username" id="username"class="TEXT"/> </td>
				</tr>
				<tr height="30px">
					<td><big><b>密&nbsp;&nbsp;码</b></big></td>
					<td><input class="TEXT" type="password" name="passwd" id="passwd"/> </td>
				</tr>
				<tr height="30px">
					<td colspan="2" align="right">
						<input class="TEXT" type='button' onclick = 'login()' value="登陆系统"/>
					</td>
				</tr>
				<!-- <tr height="20px"><td colspan="2" style="text-align:right;font-size:small"><a href = "">联系我们</a> | <a href = "">帮助中心</a> | <a href = "">其他</a></td></tr> -->
			 </table>
		</div>
	</div>
</body>
</html>